'''
Created on 16/02/2011

@author: Vinicius

Teste do Mapa auto-organizavel basico
'''
from funcoes import define_input
import som
from math import log10
from scipy.cluster.vq import whiten

entrada = define_input('../iris.data')
input = whiten(entrada[0])
print '\n===== Self-organizing maps =====\n'
print '\nComputing map...'
output = som.execute(input, [2,2], 1000/log10(1.5), 1000, 1.5, 0.05, 125)
print '...done\n'
weights = output[0]
winners = output[1]
iterations = output[2]


print 'Iterations: '+str(iterations)
for key in winners.keys():
    indices = winners.get(key)
    print '\nNeuronio #'+str(key)
    for k in range(len(indices)):
        print '#'+str(k)+';    Classe: '+str(entrada[1][indices[k]])   